//
//  ViewController.m
//  03-UITouch
//
//  Created by 韩旭 on 16/7/18.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "ViewController.h"
#define WIDETH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height
#define COLORAUTO [UIColor colorWithRed:(arc4random()%256/255.0) green:(arc4random()%256/255.0) blue:(arc4random()%256/255.0) alpha:1.0]
@interface ViewController ()
@property (nonatomic, strong) UILabel *lableButton;
@property (nonatomic, strong) UIImageView *imageBtn;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //  1. 通过UILabel封装实现只显示文字的Button
    //  2. 通过UIImageView封装实现只显示图片的Button 以上两种方式, 3. 要考虑到通用性。 封装时, 记得使用iOS9新特性
    //    使用自己封装的控件, 加入到前两天编写的登陆页中
    self.view.backgroundColor = [UIColor redColor];
    UILable_HX *lable_hx = [[UILable_HX alloc] init];
  self.lableButton = [lable_hx packWithLableText:@"我是一个按扭Button" Frame:CGRectMake(0, 0, 200, 100) Color:[UIColor yellowColor] target:self Action:@selector(creatWithBtnLable:)];
    self.lableButton.center = CGPointMake(WIDETH / 2, HEIGHT * 0.2);
    [self.view addSubview:_lableButton];
   self.imageBtn = [UIImageView packImageViewFrame:CGRectMake(0, 0, 200, 200) imagePhoto:[UIImage imageNamed:@"20151116102246252"] colorBack:[UIColor cyanColor] action:@selector(creatWithBtnImage) target:self];
    self.imageBtn.center = CGPointMake(WIDETH / 2, HEIGHT * 0.45);
    [self.view addSubview:_imageBtn];
}
//2. UIImage的方法
- (void)creatWithBtnImage {
    NSLog(@"我是一个Image");
}

//1.lable的方法
- (void)creatWithBtnLable:(UILabel *)lable {
    NSLog(@"我是一个lable");
}

@end
